//
//  HSLiveDetailCell.m
//  HolyShit
//
//  Created by Robin on 2017/3/31.
//  Copyright © 2017年 HolyShit. All rights reserved.
//

#import "HSLiveDetailCell.h"

@implementation HSLiveDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self commonInit];
    }
    return self;
}

- (void)commonInit
{
    self.backgroundColor = WHITE_COLOR;
    self.width = ScreenWidth;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    UILabel *name = [UILabel labelWithFont:MYFont(Font30) color:HEXCOLOR(HSColorBlack)];
    name.tag = 111;
    [self addSubview:name];
    [name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(5);
        make.width.mas_equalTo(35);
    }];
    UILabel *time = [UILabel labelWithFont:MYFont(Font22) color:HEXCOLOR(HSColorBlack)];
    time.tag = 222;
    [self addSubview:time];
    [time mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(name.mas_left);
        make.top.equalTo(name.mas_bottom).offset(0);
    }];
    UILabel *content = [UILabel labelWithFont:MYFont(Font28) color:HEXCOLOR(HSColorBlack)];
    content.numberOfLines = 2;
    content.lineBreakMode = NSLineBreakByClipping;
    content.tag = 333;
    content.backgroundColor = HEXCOLOR(HSColorBgDark);
    [self addSubview:content];
    [content mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.left.equalTo(name.mas_right).offset(5);
    }];
}

- (void)setModel:(HSLiveDataModel *)model
{
    _model = model;
    UILabel *name = [self viewWithTag:111];
    name.text = model.user_chn;
    UILabel *time = [self viewWithTag:222];
    time.text = model.live_ptime;
    UILabel *content = [self viewWithTag:333];
    content.text = [NSString stringWithFormat:@"  %@", model.live_text];
}

@end
